window.action = window.action || {};
action.BottonMenu = function () {
    var s = this;
    annie.Sprite.call(s);
    /*_a2x_need_start*/s.con_mc=null;s.navigate_mc=null;/*_a2x_need_end*/
    annie.initRes(s, "action", "BottonMenu");
    s.navigate_mc.mouseChildren = false;
    s.addEventListener(annie.MouseEvent.CLICK, function (e) {
        if (e.target.name == "navigate_mc") {
            if (e.localX < 280) {
                if (s.navigate_mc.currentFrame > 1) {
                    s.navigate_mc.play(false);
                    s.changeMenu(0);
                }
            } else if (e.localX > 480) {
                if (s.navigate_mc.currentFrame < s.navigate_mc.totalFrames) {
                    s.navigate_mc.play();
                    s.changeMenu(1)
                }
            }
        }else if(e.target.name=="icon"||e.target.name.indexOf("bg")==0){
            annie.globalDispatcher.dispatchEvent("onCheckItem",{obj:e.target});
        }
    });
    s.iconSp=new annieUI.ScrollList(a0.ItemCon,150,150,750,150,false);
    s.bgItems=new a0.BgItem();
    s.bgItems.y=75;
    s.bgItems.yy_mc.visible=false;
    s.iconSp.updateData([[1,0],[2,1],[2,1],[2,1],[3,0],[3,0],[3,0],[3,2],[3,2],[4,3],[4,3],[4,3]]);
    s.con_mc.addChild( s.iconSp);
};
A2xExtend(action.BottonMenu, annie.Sprite);

action.BottonMenu.prototype.changeMenu = function (id) {
    var s=this;
    s.con_mc.removeAllChildren();
    if(id==0){
        s.con_mc.addChild(s.iconSp);
        s.iconSp.alpha=0;
        annie.Tween.to(s.iconSp,0.2,{alpha:1});
    }else{
        s.bgItems.alpha=0;
        s.con_mc.addChild(s.bgItems);
        annie.Tween.to(s.bgItems,0.2,{alpha:1});
    }
};